package cn.bjit.singleton;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Person {
    //一上来就给 饿
    private static Properties pro=new Properties();
    private static  Person p=null;


    private  Person()  {
          //读取外部的配置文件
        InputStream inputStream= this.getClass().getClassLoader().getResourceAsStream("jdbc.properties");
        try {
            pro.load(inputStream);
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public static  Person getInstance()  {
        if(p==null){
             synchronized (Person.class){
                 p=new Person();
             }
        }
           return p;
       }
      public  String getValue(String key){
          return pro.getProperty(key);
      }
}
